package com.rudolphliu.dao;

import com.rudolphliu.entity.TraceBaseNode;
import java.util.Date;
import org.apache.ibatis.annotations.Arg;
import org.apache.ibatis.annotations.ConstructorArgs;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

@Repository
public interface TraceBaseNodeMapper {
    @Delete({
        "delete from trace_base_node",
        "where ID = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into trace_base_node (ID, SEQ_ID, ",
        "CITY_CODE, AREA_CODE, ",
        "SOCIAL_CREDIT_CODE, COMP_NAME, ",
        "LEGAL_TYPE, LEGAL_PERSON, ",
        "LEGAL_ID, RECORD_DATE, ",
        "ISSUING_TIME, TERM_OF_VALIDITY, ",
        "RECORD_NODE_ID, RECORD_NODE_NAME, ",
        "ADDRESS, LONGITUDE, ",
        "LATITUDE, CONTACTS, ",
        "TEL, FAX, NODE_TYPE, ",
        "CLASS_TYPE, INDUSTRY_CODE, ",
        "issend, del_flg, ",
        "create_date, update_date, ",
        "AUTH_ID, isUse, update_time, ",
        "REG_TYPE, AUTH_NAME, ",
        "UPDATETIME, BATCH_ID, ",
        "CITY_NAME, AREA_NAME, ",
        "NODE_TYPE_NAME, CLASS_TYPE_NAME, ",
        "state, business_num, ",
        "CREDIT, whether_help, ",
        "MAIN_CODE, QR_CODE, ",
        "bs_state, bs_scope, ",
        "applytime, reviewtime)",
        "values (#{id,jdbcType=INTEGER}, #{seqId,jdbcType=VARCHAR}, ",
        "#{cityCode,jdbcType=VARCHAR}, #{areaCode,jdbcType=VARCHAR}, ",
        "#{socialCreditCode,jdbcType=VARCHAR}, #{compName,jdbcType=VARCHAR}, ",
        "#{legalType,jdbcType=VARCHAR}, #{legalPerson,jdbcType=VARCHAR}, ",
        "#{legalId,jdbcType=VARCHAR}, #{recordDate,jdbcType=VARCHAR}, ",
        "#{issuingTime,jdbcType=VARCHAR}, #{termOfValidity,jdbcType=VARCHAR}, ",
        "#{recordNodeId,jdbcType=VARCHAR}, #{recordNodeName,jdbcType=VARCHAR}, ",
        "#{address,jdbcType=VARCHAR}, #{longitude,jdbcType=DOUBLE}, ",
        "#{latitude,jdbcType=DOUBLE}, #{contacts,jdbcType=VARCHAR}, ",
        "#{tel,jdbcType=VARCHAR}, #{fax,jdbcType=VARCHAR}, #{nodeType,jdbcType=VARCHAR}, ",
        "#{classType,jdbcType=VARCHAR}, #{industryCode,jdbcType=VARCHAR}, ",
        "#{issend,jdbcType=VARCHAR}, #{delFlg,jdbcType=INTEGER}, ",
        "#{createDate,jdbcType=BIGINT}, #{updateDate,jdbcType=BIGINT}, ",
        "#{authId,jdbcType=VARCHAR}, #{isuse,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{regType,jdbcType=VARCHAR}, #{authName,jdbcType=VARCHAR}, ",
        "#{updatetime,jdbcType=VARCHAR}, #{batchId,jdbcType=VARCHAR}, ",
        "#{cityName,jdbcType=VARCHAR}, #{areaName,jdbcType=VARCHAR}, ",
        "#{nodeTypeName,jdbcType=VARCHAR}, #{classTypeName,jdbcType=VARCHAR}, ",
        "#{state,jdbcType=VARCHAR}, #{businessNum,jdbcType=INTEGER}, ",
        "#{credit,jdbcType=VARCHAR}, #{whetherHelp,jdbcType=VARCHAR}, ",
        "#{mainCode,jdbcType=VARCHAR}, #{qrCode,jdbcType=VARCHAR}, ",
        "#{bsState,jdbcType=VARCHAR}, #{bsScope,jdbcType=VARCHAR}, ",
        "#{applytime,jdbcType=TIMESTAMP}, #{reviewtime,jdbcType=TIMESTAMP})"
    })
    int insert(TraceBaseNode record);

    @InsertProvider(type=TraceBaseNodeSqlProvider.class, method="insertSelective")
    int insertSelective(TraceBaseNode record);

    @Select({
        "select",
        "ID, SEQ_ID, CITY_CODE, AREA_CODE, SOCIAL_CREDIT_CODE, COMP_NAME, LEGAL_TYPE, ",
        "LEGAL_PERSON, LEGAL_ID, RECORD_DATE, ISSUING_TIME, TERM_OF_VALIDITY, RECORD_NODE_ID, ",
        "RECORD_NODE_NAME, ADDRESS, LONGITUDE, LATITUDE, CONTACTS, TEL, FAX, NODE_TYPE, ",
        "CLASS_TYPE, INDUSTRY_CODE, issend, del_flg, create_date, update_date, AUTH_ID, ",
        "isUse, update_time, REG_TYPE, AUTH_NAME, UPDATETIME, BATCH_ID, CITY_NAME, AREA_NAME, ",
        "NODE_TYPE_NAME, CLASS_TYPE_NAME, state, business_num, CREDIT, whether_help, ",
        "MAIN_CODE, QR_CODE, bs_state, bs_scope, applytime, reviewtime",
        "from trace_base_node",
        "where ID = #{id,jdbcType=INTEGER}"
    })
    @ConstructorArgs({
        @Arg(column="ID", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="SEQ_ID", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="CITY_CODE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="AREA_CODE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="SOCIAL_CREDIT_CODE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="COMP_NAME", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="LEGAL_TYPE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="LEGAL_PERSON", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="LEGAL_ID", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="RECORD_DATE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="ISSUING_TIME", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="TERM_OF_VALIDITY", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="RECORD_NODE_ID", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="RECORD_NODE_NAME", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="ADDRESS", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="LONGITUDE", javaType=Double.class, jdbcType=JdbcType.DOUBLE),
        @Arg(column="LATITUDE", javaType=Double.class, jdbcType=JdbcType.DOUBLE),
        @Arg(column="CONTACTS", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="TEL", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="FAX", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="NODE_TYPE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="CLASS_TYPE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="INDUSTRY_CODE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="issend", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="del_flg", javaType=Integer.class, jdbcType=JdbcType.INTEGER),
        @Arg(column="create_date", javaType=Long.class, jdbcType=JdbcType.BIGINT),
        @Arg(column="update_date", javaType=Long.class, jdbcType=JdbcType.BIGINT),
        @Arg(column="AUTH_ID", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="isUse", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="update_time", javaType=Date.class, jdbcType=JdbcType.TIMESTAMP),
        @Arg(column="REG_TYPE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="AUTH_NAME", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="UPDATETIME", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="BATCH_ID", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="CITY_NAME", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="AREA_NAME", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="NODE_TYPE_NAME", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="CLASS_TYPE_NAME", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="state", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="business_num", javaType=Integer.class, jdbcType=JdbcType.INTEGER),
        @Arg(column="CREDIT", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="whether_help", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="MAIN_CODE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="QR_CODE", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="bs_state", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="bs_scope", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="applytime", javaType=Date.class, jdbcType=JdbcType.TIMESTAMP),
        @Arg(column="reviewtime", javaType=Date.class, jdbcType=JdbcType.TIMESTAMP)
    })
    TraceBaseNode selectByPrimaryKey(Integer id);

    @UpdateProvider(type=TraceBaseNodeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TraceBaseNode record);

    @Update({
        "update trace_base_node",
        "set SEQ_ID = #{seqId,jdbcType=VARCHAR},",
          "CITY_CODE = #{cityCode,jdbcType=VARCHAR},",
          "AREA_CODE = #{areaCode,jdbcType=VARCHAR},",
          "SOCIAL_CREDIT_CODE = #{socialCreditCode,jdbcType=VARCHAR},",
          "COMP_NAME = #{compName,jdbcType=VARCHAR},",
          "LEGAL_TYPE = #{legalType,jdbcType=VARCHAR},",
          "LEGAL_PERSON = #{legalPerson,jdbcType=VARCHAR},",
          "LEGAL_ID = #{legalId,jdbcType=VARCHAR},",
          "RECORD_DATE = #{recordDate,jdbcType=VARCHAR},",
          "ISSUING_TIME = #{issuingTime,jdbcType=VARCHAR},",
          "TERM_OF_VALIDITY = #{termOfValidity,jdbcType=VARCHAR},",
          "RECORD_NODE_ID = #{recordNodeId,jdbcType=VARCHAR},",
          "RECORD_NODE_NAME = #{recordNodeName,jdbcType=VARCHAR},",
          "ADDRESS = #{address,jdbcType=VARCHAR},",
          "LONGITUDE = #{longitude,jdbcType=DOUBLE},",
          "LATITUDE = #{latitude,jdbcType=DOUBLE},",
          "CONTACTS = #{contacts,jdbcType=VARCHAR},",
          "TEL = #{tel,jdbcType=VARCHAR},",
          "FAX = #{fax,jdbcType=VARCHAR},",
          "NODE_TYPE = #{nodeType,jdbcType=VARCHAR},",
          "CLASS_TYPE = #{classType,jdbcType=VARCHAR},",
          "INDUSTRY_CODE = #{industryCode,jdbcType=VARCHAR},",
          "issend = #{issend,jdbcType=VARCHAR},",
          "del_flg = #{delFlg,jdbcType=INTEGER},",
          "create_date = #{createDate,jdbcType=BIGINT},",
          "update_date = #{updateDate,jdbcType=BIGINT},",
          "AUTH_ID = #{authId,jdbcType=VARCHAR},",
          "isUse = #{isuse,jdbcType=VARCHAR},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "REG_TYPE = #{regType,jdbcType=VARCHAR},",
          "AUTH_NAME = #{authName,jdbcType=VARCHAR},",
          "UPDATETIME = #{updatetime,jdbcType=VARCHAR},",
          "BATCH_ID = #{batchId,jdbcType=VARCHAR},",
          "CITY_NAME = #{cityName,jdbcType=VARCHAR},",
          "AREA_NAME = #{areaName,jdbcType=VARCHAR},",
          "NODE_TYPE_NAME = #{nodeTypeName,jdbcType=VARCHAR},",
          "CLASS_TYPE_NAME = #{classTypeName,jdbcType=VARCHAR},",
          "state = #{state,jdbcType=VARCHAR},",
          "business_num = #{businessNum,jdbcType=INTEGER},",
          "CREDIT = #{credit,jdbcType=VARCHAR},",
          "whether_help = #{whetherHelp,jdbcType=VARCHAR},",
          "MAIN_CODE = #{mainCode,jdbcType=VARCHAR},",
          "QR_CODE = #{qrCode,jdbcType=VARCHAR},",
          "bs_state = #{bsState,jdbcType=VARCHAR},",
          "bs_scope = #{bsScope,jdbcType=VARCHAR},",
          "applytime = #{applytime,jdbcType=TIMESTAMP},",
          "reviewtime = #{reviewtime,jdbcType=TIMESTAMP}",
        "where ID = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TraceBaseNode record);
}